define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'weixin.user/index',
        add_url: 'weixin.user/add',
        edit_url: 'weixin.user/edit',
        delete_url: 'weixin.user/delete',
        export_url: 'weixin.user/export',
        modify_url: 'weixin.user/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh','delete', 'export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'openid', title: '用户识别号'},
                    {field: 'type', search: 'select', selectList: ["小程序","微信公众号"], title: '用户类型'},
                    {field: 'nickName', title: '用户昵称'},
                    {field: 'realname', title: '真实姓名'},
                    {field: 'mobile', title: '手机号'},
                    {field: 'avatarUrl', title: '用户头像', templet: ea.table.image},
                    {field: 'create_time', title: '创建时间'},
                    {field: 'status', search: 'select', selectList: ["禁用","启用"], title: '状态', templet: ea.table.switch},
                    {width: 100, title: '操作', templet: ea.table.tool,operat: ['delete']},
                ]],

            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});